import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CommissionHeaderVO, CommissionHeaderForm, CommissionHeaderQuery } from '@/api/commission/commissionHeader/types';

/**
 * 查询佣金清单字段列表
 * @param query
 * @returns {*}
 */

export const listCommissionHeader = (query?: CommissionHeaderQuery): AxiosPromise<CommissionHeaderVO[]> => {
  return request({
    url: '/commission/commissionHeader/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询佣金清单字段详细
 * @param id
 */
export const getCommissionHeader = (id: string | number): AxiosPromise<CommissionHeaderVO> => {
  return request({
    url: '/commission/commissionHeader/' + id,
    method: 'get'
  });
};

/**
 * 新增佣金清单字段
 * @param data
 */
export const addCommissionHeader = (data: CommissionHeaderForm) => {
  return request({
    url: '/commission/commissionHeader',
    method: 'post',
    data: data
  });
};

/**
 * 修改佣金清单字段
 * @param data
 */
export const updateCommissionHeader = (data: CommissionHeaderForm) => {
  return request({
    url: '/commission/commissionHeader',
    method: 'put',
    data: data
  });
};

/**
 * 删除佣金清单字段
 * @param id
 */
export const delCommissionHeader = (id: string | number | Array<string | number>) => {
  return request({
    url: '/commission/commissionHeader/' + id,
    method: 'delete'
  });
};
